<ui:composition template = "template.xhtml"
                xmlns ="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core">
    <ui:define name ="conteudo">
        
        <h:form>

            <h:outputText value="Nome Acervo: " />
            <h:inputText value="#{acervos.acervo.descricao}" id="tbDescricao" />

            <h:outputText value="Publicavel: " />
            <h:selectBooleanCheckbox value="#{acervos.acervo.publicavel}" id="cbPublicavel" />

            <h:dataTable value="#{acervos.acervo.acervoCampo}" var="ac" >

                <h:column>
                    <f:facet name="header">Campo</f:facet>
                    #{ac.campo.titulo}
                </h:column>

                <h:column>
                    <f:facet name="header">Tipo Campo</f:facet>
                    #{ac.campo.tipoCampo.descricao}
                </h:column>

                <h:column>
                    <f:facet name="header">Repetitivo</f:facet>
                    <h:selectBooleanCheckbox value="#{ac.repetitivo}" id="cbRepetitivo" />      
                </h:column>

                <h:column>
                    <f:facet name="header">Obrigatório</f:facet>
                    <h:selectBooleanCheckbox value="#{ac.obrigatorio}" id="cbObrigatorio" />
                </h:column>

                <h:column>
                    <f:facet name="header">Publicar</f:facet>
                    <h:selectBooleanCheckbox value="#{ac.publicar}" id="cbPublicar" />
                </h:column>

                <h:column>
                    <f:facet name="header">Valor Padrão</f:facet>
                    <h:inputText value="#{ac.valorPadrao}" id="tbValorPadrao" />
                </h:column>

                <h:column>
                    <f:facet name="header">Apresentação</f:facet>
                    <h:inputText value="#{ac.apresentacao}" id="tbApresentacao" />
                </h:column>

                <h:column>
                    <f:facet name="header">Restrição</f:facet>
                    <h:inputText value="#{ac.restricao}" id="tbRestricao" />
                </h:column>

            </h:dataTable>

            <h:commandButton value="Editar">
                <f:ajax
                    event ="click"
                    execute ="@form"
                    listener ="#{acervos.update()}"
                    render ="@all" />
                <f:param name="chave" value="#{acervos.acervo.chaveAcervo}" />
            </h:commandButton>


        </h:form>

    </ui:define>
</ui:composition>